package com.order.mapper;

import com.order.bean.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface UserMapper {

    @Select("select * from user where username=#{username}")
    User selectByUsername(String username);

    @Insert("insert into user (username, password, name, avatar, role, sex, phone) " +
            "values (#{username}, #{password}, #{name},#{avatar}, #{role}, #{sex}, #{phone})")
    boolean insert(User user);

    boolean updateById(User user);

    @Delete("delete from user where id = #{id}")
    boolean deleteById(Integer id);

    @Select("select * from user where id = #{id}")
    User selectById(Integer id);

    List<User> selectAll(String username);

}
